KAFKA-20297: move Scheduler from client common to trogdor#21753
Merged
chia7712 merged 4 commits intoapache:trunkfrom Mar 18, 2026
Merged
KAFKA-20297: move Scheduler from client common to trogdor#21753chia7712 merged 4 commits intoapache:trunkfrom
chia7712 merged 4 commits intoapache:trunkfrom
Conversation
…ocal mock scheduler for client test
…ialRefreshingLoginTest
38cf2b2 to
b17f21a
Compare
chia7712
reviewed
Mar 17, 2026
| } | ||
|
|
||
| @Override | ||
| public synchronized void onTimeUpdated() { |
Member
There was a problem hiding this comment.
@Override
public synchronized void onTimeUpdated() {
long timeMs = time.milliseconds();
var iterator = waiters.entrySet().iterator();
while (iterator.hasNext()) {
var entry = iterator.next();
if (entry.getKey() > timeMs) break;
entry.getValue().forEach(future -> future.complete(timeMs));
iterator.remove();
}
}| /** | ||
| * Futures which are waiting for a specified wall-clock time to arrive. | ||
| */ | ||
| private final TreeMap<Long, List<KafkaFutureImpl<Long>>> waiters = new TreeMap<>(); |
Member
There was a problem hiding this comment.
Map<Long, List<KafkaFutureImpl<Long>>>
| } | ||
| } | ||
|
|
||
| /* |
Member
There was a problem hiding this comment.
could you remove unused comment?
| * limitations under the License. | ||
| */ | ||
| package org.apache.kafka.common.utils; | ||
| package org.apache.kafka.trogdor.common; |
Member
There was a problem hiding this comment.
Could we inline SystemScheduler?
public interface Scheduler {
Scheduler SYSTEM = new Scheduler() {
@Override
public Time time() {
return Time.SYSTEM;
}
@Override
public <T> Future<T> schedule(ScheduledExecutorService executor, Callable<T> callable, long delayMs) {
return executor.schedule(callable, delayMs, TimeUnit.MILLISECONDS);
}
};
Contributor
Author
There was a problem hiding this comment.
thanks for the suggestion!! done in 4391eac
| import org.apache.kafka.common.utils.Scheduler; | ||
| import org.apache.kafka.common.utils.Utils; | ||
|
|
||
| import com.fasterxml.jackson.databind.JsonNode; |
Member
There was a problem hiding this comment.
TROGDOR_COORDINATOR_HEARTBEAT_MS and TROGDOR_COORDINATOR_HEARTBEAT_MS_DEFAULT are unused. Could you remove them?
chia7712
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary This PR refactors the Scheduler utility and its
implementations by moving them from the
clientsmodule to thetrogdormodule. It also ensures that client-side tests that previouslyrelied on MockScheduler remain functional by implementing a local
version where needed.
Key Changes - Package Relocation: Moved
Scheduler,SystemScheduler, andMockSchedulerfromorg.apache.kafka.common.utilstoorg.apache.kafka.trogdor.common. - Trogdor Updates: Updated allreferences in the trogdor module (including
Agent,Coordinator,TaskManager, andWorkerManager) to point to the new locationof the Scheduler interface and its implementations. - Client Test
Stability: Added a private
MockSchedulerinner class toExpiringCredentialRefreshingLoginTest.java. This replaces thedependency on the global MockScheduler that was moved to Trogdor,
keeping the clients module tests decoupled from trogdor. - Cleaned
Up Imports: Removed unused imports and updated package declarations
across 13 files to reflect the architectural shift.
Reviewers: Chia-Ping Tsai chia7712@gmail.com